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
 
@@ -152,62 +152,24 @@ class TestSubcommand(TestCase):
 
        # Not sure this is really the way to test this, but...
 
        self.assertEqual(len(subcommand.parser._action_groups[0]._actions), 1)
 
        subcommand.add_parser_args(subcommand.parser)
 
        self.assertEqual(len(subcommand.parser._action_groups[0]._actions), 1)
 

	
 
    def test_run_not_implemented(self):
 
        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):
 
#         commands.main('filemon', '--no-init', 'start')
 
#         start_daemon.assert_called_once_with(None, None, True)
 

	
 
#     @patch('rattail.filemon.linux.start_daemon')
 
#     def test_start_daemon_with_explicit_args(self, start_daemon):
 
#         tmp = TempIO()
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)
 
        email = customer.emails[0]
 
        self.assertEqual(email.type, 'Home')
 

	
 
        customer = model.Customer()
 
        self.assertEqual(len(customer.emails), 0)
 
        customer.add_email_address('fred@mailinator.com', type='Work')
 
@@ -42,22 +30,12 @@ class TestCustomer(DataTestCase):
 
        self.assertEqual(len(customer.phones), 0)
 
        customer.add_phone_number('417-555-1234')
 
        self.assertEqual(len(customer.phones), 1)
 
        phone = customer.phones[0]
 
        self.assertEqual(phone.type, 'Home')
 

	
 
        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)