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
 
@@ -161,44 +161,6 @@ class TestSubcommand(TestCase):
 
        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):
rattail/tests/db/model/test_customers.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# -*- coding: utf-8; -*-
 

	
 
from __future__ import unicode_literals, absolute_import
 

	
 
@@ -8,18 +8,6 @@ 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()
 
@@ -51,13 +39,3 @@ class TestCustomer(DataTestCase):
 
        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)