Changeset - ad5e26437c21
[Not reviewed]
0 2 0
Lance Edgar (lance) - 8 years ago 2017-03-21 15:07:08
lance@edbob.org
Remove unwanted tests
2 files changed with 1 insertions and 61 deletions:
0 comments (0 inline, 0 general)
rattail/tests/commands/test_core.py
Show inline comments
 
@@ -158,50 +158,12 @@ class TestSubcommand(TestCase):
 
        command = core.Command()
 
        subcommand = core.Subcommand(command)
 
        args = subcommand.parser.parse_args([])
 
        self.assertRaises(NotImplementedError, subcommand.run, args)
 

	
 

	
 
class TestDump(DataTestCase):
 

	
 
    def setUp(self):
 
        super(TestDump, self).setUp()
 
        self.session.add(model.Product(upc='074305001321'))
 
        self.session.add(model.Product(upc='074305001161'))
 
        self.session.commit()
 

	
 
    def test_unknown_model_cannot_be_dumped(self):
 
        tmp = TempIO()
 
        stderr_path = tmp.putfile('stderr.txt', '')
 
        self.assertRaises(SystemExit, core.main, '--no-init', '--stderr', stderr_path, 'dump', 'NoSuchModel')
 
        with open(stderr_path) as f:
 
            self.assertEqual(f.read(), "Unknown model: NoSuchModel\n")
 

	
 
    def test_dump_goes_to_stdout_by_default(self):
 
        tmp = TempIO()
 
        stdout_path = tmp.putfile('stdout.txt', '')
 
        core.main('--no-init', '--stdout', stdout_path, 'dump', 'Product')
 
        with open(stdout_path, 'rb') as csv_file:
 
            reader = csv.DictReader(csv_file)
 
            upcs = [row['upc'] for row in reader]
 
        self.assertEqual(len(upcs), 2)
 
        self.assertTrue('00074305001321' in upcs)
 
        self.assertTrue('00074305001161' in upcs)
 

	
 
    def test_dump_goes_to_file_if_so_invoked(self):
 
        tmp = TempIO()
 
        output_path = tmp.putfile('output.txt', '')
 
        core.main('--no-init', 'dump', 'Product', '--output', output_path)
 
        with open(output_path, 'rb') as csv_file:
 
            reader = csv.DictReader(csv_file)
 
            upcs = [row['upc'] for row in reader]
 
        self.assertEqual(len(upcs), 2)
 
        self.assertTrue('00074305001321' in upcs)
 
        self.assertTrue('00074305001161' in upcs)
 

	
 

	
 
# TODO: more broken tests..ugh.  these aren't very good or else i might bother
 
# fixing them...
 
# class TestFileMonitor(TestCase):
 

	
 
#     @patch('rattail.filemon.linux.start_daemon')
 
#     def test_start_daemon_with_default_args(self, start_daemon):
rattail/tests/db/model/test_customers.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# -*- coding: utf-8; -*-
 

	
 
from __future__ import unicode_literals, absolute_import
 

	
 
from rattail.db import model
 
from rattail.tests import DataTestCase
 

	
 

	
 
class TestCustomer(DataTestCase):
 

	
 
    def test_unicode(self):
 
        customer = model.Customer()
 
        self.assertEqual(unicode(customer), "")
 

	
 
        customer = model.Customer(name=b"Fred Flintstone")
 
        self.assertEqual(unicode(customer), "Fred Flintstone")
 

	
 
        customer = model.Customer(people=[model.Person(first_name="Fred", last_name="Flintstone")])
 
        self.session.add(customer)
 
        self.session.flush()
 
        self.assertEqual(unicode(customer), "Fred Flintstone")
 

	
 
    # TODO: this is duplicated in TestPerson
 
    def test_add_email_address(self):
 
        customer = model.Customer()
 
        self.assertEqual(len(customer.emails), 0)
 
        customer.add_email_address('fred@mailinator.com')
 
        self.assertEqual(len(customer.emails), 1)
 
@@ -48,16 +36,6 @@ class TestCustomer(DataTestCase):
 
        customer = model.Customer()
 
        self.assertEqual(len(customer.phones), 0)
 
        customer.add_phone_number('417-555-1234', type='Work')
 
        self.assertEqual(len(customer.phones), 1)
 
        phone = customer.phones[0]
 
        self.assertEqual(phone.type, 'Work')
 

	
 

	
 
class TestCustomerGroup(DataTestCase):
 

	
 
    def test_unicode(self):
 
        group = model.CustomerGroup()
 
        self.assertEqual(unicode(group), "")
 

	
 
        group = model.CustomerGroup(name=b"Loyal Shoppers")
 
        self.assertEqual(unicode(group), "Loyal Shoppers")
0 comments (0 inline, 0 general)