2014-10-06 19:10:03 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2016-12-31 11:01:36 +00:00
|
|
|
# Copyright (c) 2008-2017 OpenLP Developers #
|
2014-10-06 19:10:03 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
|
|
# under the terms of the GNU General Public License as published by the Free #
|
|
|
|
# Software Foundation; version 2 of the License. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
|
|
|
# more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License along #
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
|
|
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
|
|
###############################################################################
|
|
|
|
"""
|
|
|
|
Package to test the openlp.core.ui.projectordb find, edit, delete
|
|
|
|
record functions.
|
|
|
|
|
|
|
|
PREREQUISITE: add_record() and get_all() functions validated.
|
|
|
|
"""
|
2016-01-06 20:02:39 +00:00
|
|
|
import os
|
2014-10-06 19:10:03 +00:00
|
|
|
from unittest import TestCase
|
2017-04-24 05:17:55 +00:00
|
|
|
from unittest.mock import MagicMock, patch
|
2014-10-06 19:10:03 +00:00
|
|
|
|
2016-05-20 16:22:06 +00:00
|
|
|
from openlp.core.lib.projector.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource, Source
|
2016-05-21 08:31:24 +00:00
|
|
|
from openlp.core.lib.projector.constants import PJLINK_PORT
|
2014-10-06 19:10:03 +00:00
|
|
|
|
2016-01-07 21:07:55 +00:00
|
|
|
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def compare_data(one, two):
|
|
|
|
"""
|
|
|
|
Verify two Projector() instances contain the same data
|
|
|
|
"""
|
|
|
|
return one is not None and \
|
|
|
|
two is not None and \
|
|
|
|
one.ip == two.ip and \
|
|
|
|
one.port == two.port and \
|
|
|
|
one.name == two.name and \
|
|
|
|
one.location == two.location and \
|
|
|
|
one.notes == two.notes
|
|
|
|
|
|
|
|
|
2015-01-19 22:36:53 +00:00
|
|
|
def compare_source(one, two):
|
|
|
|
"""
|
|
|
|
Verify two ProjectorSource instances contain the same data
|
|
|
|
"""
|
|
|
|
return one is not None and \
|
|
|
|
two is not None and \
|
|
|
|
one.projector_id == two.projector_id and \
|
|
|
|
one.code == two.code and \
|
|
|
|
one.text == two.text
|
|
|
|
|
|
|
|
|
2016-01-06 20:02:39 +00:00
|
|
|
def add_records(projector_db, test):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Add record if not in database
|
|
|
|
"""
|
2016-01-06 20:02:39 +00:00
|
|
|
record_list = projector_db.get_projector_all()
|
2014-10-06 19:10:03 +00:00
|
|
|
if len(record_list) < 1:
|
|
|
|
added = False
|
|
|
|
for record in test:
|
2016-01-06 20:02:39 +00:00
|
|
|
added = projector_db.add_projector(record) or added
|
2014-10-06 19:10:03 +00:00
|
|
|
return added
|
|
|
|
|
|
|
|
for new_record in test:
|
|
|
|
added = None
|
|
|
|
for record in record_list:
|
|
|
|
if compare_data(record, new_record):
|
|
|
|
break
|
2016-01-06 20:02:39 +00:00
|
|
|
added = projector_db.add_projector(new_record)
|
2014-10-06 19:10:03 +00:00
|
|
|
return added
|
|
|
|
|
|
|
|
|
|
|
|
class TestProjectorDB(TestCase):
|
|
|
|
"""
|
|
|
|
Test case for ProjectorDB
|
|
|
|
"""
|
2016-04-29 20:25:12 +00:00
|
|
|
@patch('openlp.core.lib.projector.db.init_url')
|
|
|
|
def setUp(self, mocked_init_url):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Set up anything necessary for all tests
|
|
|
|
"""
|
2016-04-29 20:25:12 +00:00
|
|
|
mocked_init_url.return_value = 'sqlite:///{db}'.format(db=TEST_DB)
|
|
|
|
self.projector = ProjectorDB()
|
2014-10-06 19:10:03 +00:00
|
|
|
|
2015-11-26 20:44:19 +00:00
|
|
|
def tearDown(self):
|
|
|
|
"""
|
|
|
|
Clean up
|
|
|
|
"""
|
2016-01-07 21:57:01 +00:00
|
|
|
self.projector.session.close()
|
2015-11-26 20:44:19 +00:00
|
|
|
self.projector = None
|
2016-01-15 19:41:14 +00:00
|
|
|
retries = 0
|
2016-01-15 19:14:24 +00:00
|
|
|
while retries < 5:
|
|
|
|
try:
|
|
|
|
if os.path.exists(TEST_DB):
|
|
|
|
os.unlink(TEST_DB)
|
|
|
|
break
|
|
|
|
except:
|
|
|
|
time.sleep(1)
|
|
|
|
retries += 1
|
2015-11-26 20:44:19 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_find_record_by_ip(self):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Test find record by IP
|
|
|
|
"""
|
|
|
|
# GIVEN: Record entries in database
|
2016-01-07 21:07:55 +00:00
|
|
|
add_records(self.projector, [Projector(**TEST1_DATA), Projector(**TEST2_DATA)])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# WHEN: Search for record using IP
|
2016-01-07 21:07:55 +00:00
|
|
|
record = self.projector.get_projector_by_ip(TEST2_DATA['ip'])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# THEN: Verify proper record returned
|
2016-01-07 21:07:55 +00:00
|
|
|
self.assertTrue(compare_data(Projector(**TEST2_DATA), record),
|
2014-10-06 19:10:03 +00:00
|
|
|
'Record found should have been test_2 data')
|
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_find_record_by_name(self):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Test find record by name
|
|
|
|
"""
|
|
|
|
# GIVEN: Record entries in database
|
2016-01-07 21:07:55 +00:00
|
|
|
add_records(self.projector, [Projector(**TEST1_DATA), Projector(**TEST2_DATA)])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# WHEN: Search for record using name
|
2016-01-07 21:07:55 +00:00
|
|
|
record = self.projector.get_projector_by_name(TEST2_DATA['name'])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# THEN: Verify proper record returned
|
2016-01-07 21:07:55 +00:00
|
|
|
self.assertTrue(compare_data(Projector(**TEST2_DATA), record),
|
2014-10-06 19:10:03 +00:00
|
|
|
'Record found should have been test_2 data')
|
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_record_delete(self):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Test record can be deleted
|
|
|
|
"""
|
|
|
|
# GIVEN: Record in database
|
2016-01-07 21:07:55 +00:00
|
|
|
add_records(self.projector, [Projector(**TEST3_DATA), ])
|
|
|
|
record = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# WHEN: Record deleted
|
|
|
|
self.projector.delete_projector(record)
|
|
|
|
|
|
|
|
# THEN: Verify record not retrievable
|
2016-01-07 21:07:55 +00:00
|
|
|
found = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
|
2014-10-06 19:10:03 +00:00
|
|
|
self.assertFalse(found, 'test_3 record should have been deleted')
|
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_record_edit(self):
|
2014-10-06 19:10:03 +00:00
|
|
|
"""
|
|
|
|
Test edited record returns the same record ID with different data
|
|
|
|
"""
|
|
|
|
# GIVEN: Record entries in database
|
2016-01-07 21:07:55 +00:00
|
|
|
add_records(self.projector, [Projector(**TEST1_DATA), Projector(**TEST2_DATA)])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# WHEN: We retrieve a specific record
|
2016-01-07 21:07:55 +00:00
|
|
|
record = self.projector.get_projector_by_ip(TEST1_DATA['ip'])
|
2014-10-06 19:10:03 +00:00
|
|
|
record_id = record.id
|
|
|
|
|
|
|
|
# WHEN: Data is changed
|
2016-01-07 21:07:55 +00:00
|
|
|
record.ip = TEST3_DATA['ip']
|
|
|
|
record.port = TEST3_DATA['port']
|
|
|
|
record.pin = TEST3_DATA['pin']
|
|
|
|
record.name = TEST3_DATA['name']
|
|
|
|
record.location = TEST3_DATA['location']
|
|
|
|
record.notes = TEST3_DATA['notes']
|
2014-10-06 19:10:03 +00:00
|
|
|
updated = self.projector.update_projector(record)
|
|
|
|
self.assertTrue(updated, 'Save updated record should have returned True')
|
2016-01-07 21:07:55 +00:00
|
|
|
record = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
|
2014-10-06 19:10:03 +00:00
|
|
|
|
|
|
|
# THEN: Record ID should remain the same, but data should be changed
|
|
|
|
self.assertEqual(record_id, record.id, 'Edited record should have the same ID')
|
2016-01-07 21:07:55 +00:00
|
|
|
self.assertTrue(compare_data(Projector(**TEST3_DATA), record), 'Edited record should have new data')
|
2015-01-19 22:36:53 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_source_add(self):
|
2015-01-19 22:36:53 +00:00
|
|
|
"""
|
2015-01-20 15:44:55 +00:00
|
|
|
Test source entry for projector item
|
2015-01-19 22:36:53 +00:00
|
|
|
"""
|
|
|
|
# GIVEN: Record entries in database
|
2016-01-07 21:07:55 +00:00
|
|
|
projector1 = Projector(**TEST1_DATA)
|
|
|
|
self.projector.add_projector(projector1)
|
|
|
|
item = self.projector.get_projector_by_id(projector1.id)
|
2015-01-19 22:36:53 +00:00
|
|
|
item_id = item.id
|
2015-01-20 15:44:55 +00:00
|
|
|
|
|
|
|
# WHEN: A source entry is saved for item
|
2015-01-19 22:36:53 +00:00
|
|
|
source = ProjectorSource(projector_id=item_id, code='11', text='First RGB source')
|
|
|
|
self.projector.add_source(source)
|
|
|
|
|
|
|
|
# THEN: Projector should have the same source entry
|
2015-01-20 15:44:55 +00:00
|
|
|
item = self.projector.get_projector_by_id(item_id)
|
2015-01-19 22:36:53 +00:00
|
|
|
self.assertTrue(compare_source(item.source_list[0], source))
|
2016-04-29 20:25:12 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_manufacturer_repr(self):
|
2016-04-29 20:25:12 +00:00
|
|
|
"""
|
2017-01-27 13:19:33 +00:00
|
|
|
Test Manufacturer.__repr__() text
|
2016-04-29 20:25:12 +00:00
|
|
|
"""
|
|
|
|
# GIVEN: Test object
|
|
|
|
manufacturer = Manufacturer()
|
|
|
|
|
|
|
|
# WHEN: Name is set
|
|
|
|
manufacturer.name = 'OpenLP Test'
|
|
|
|
|
|
|
|
# THEN: __repr__ should return a proper string
|
|
|
|
self.assertEqual(str(manufacturer), '<Manufacturer(name="OpenLP Test")>',
|
|
|
|
'Manufacturer.__repr__() should have returned a proper representation string')
|
2016-05-14 04:24:46 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_model_repr(self):
|
2016-05-14 04:24:46 +00:00
|
|
|
"""
|
2017-01-27 13:19:33 +00:00
|
|
|
Test Model.__repr__() text
|
2016-05-14 04:24:46 +00:00
|
|
|
"""
|
|
|
|
# GIVEN: Test object
|
|
|
|
model = Model()
|
|
|
|
|
|
|
|
# WHEN: Name is set
|
|
|
|
model.name = 'OpenLP Test'
|
|
|
|
|
|
|
|
# THEN: __repr__ should return a proper string
|
2016-05-15 17:32:04 +00:00
|
|
|
self.assertEqual(str(model), '<Model(name='"OpenLP Test"')>',
|
2016-05-14 04:24:46 +00:00
|
|
|
'Model.__repr__() should have returned a proper representation string')
|
2016-05-20 16:22:06 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_source_repr(self):
|
2016-05-20 16:22:06 +00:00
|
|
|
"""
|
2017-01-27 13:19:33 +00:00
|
|
|
Test Source.__repr__() text
|
2016-05-20 16:22:06 +00:00
|
|
|
"""
|
|
|
|
# GIVEN: Test object
|
|
|
|
source = Source()
|
|
|
|
|
|
|
|
# WHEN: Source() information is set
|
|
|
|
source.pjlink_name = 'Test object'
|
|
|
|
source.pjlink_code = '11'
|
|
|
|
source.text = 'Input text'
|
|
|
|
|
|
|
|
# THEN: __repr__ should return a proper string
|
|
|
|
self.assertEqual(str(source), '<Source(pjlink_name="Test object", pjlink_code="11", text="Input text")>',
|
|
|
|
'Source.__repr__() should have returned a proper representation string')
|
2016-05-21 08:31:24 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_projector_repr(self):
|
2016-05-21 08:31:24 +00:00
|
|
|
"""
|
|
|
|
Test Projector.__repr__() text
|
|
|
|
"""
|
|
|
|
# GIVEN: Test object
|
|
|
|
projector = Projector()
|
|
|
|
|
|
|
|
# WHEN: projector() is populated
|
|
|
|
# NOTE: projector.pin, projector.other, projector.sources should all return None
|
|
|
|
# projector.source_list should return an empty list
|
|
|
|
projector.id = 0
|
|
|
|
projector.ip = '127.0.0.1'
|
|
|
|
projector.port = PJLINK_PORT
|
|
|
|
projector.name = 'Test One'
|
|
|
|
projector.location = 'Somewhere over the rainbow'
|
|
|
|
projector.notes = 'Not again'
|
|
|
|
projector.pjlink_name = 'TEST'
|
|
|
|
projector.manufacturer = 'IN YOUR DREAMS'
|
|
|
|
projector.model = 'OpenLP'
|
|
|
|
|
|
|
|
# THEN: __repr__ should return a proper string
|
|
|
|
self.assertEqual(str(projector),
|
|
|
|
'< Projector(id="0", ip="127.0.0.1", port="4352", pin="None", name="Test One", '
|
|
|
|
'location="Somewhere over the rainbow", notes="Not again", pjlink_name="TEST", '
|
|
|
|
'manufacturer="IN YOUR DREAMS", model="OpenLP", other="None", sources="None", '
|
|
|
|
'source_list="[]") >',
|
|
|
|
'Projector.__repr__() should have returned a proper representation string')
|
2016-05-27 08:13:14 +00:00
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_projectorsource_repr(self):
|
2016-05-27 08:13:14 +00:00
|
|
|
"""
|
|
|
|
Test ProjectorSource.__repr__() text
|
|
|
|
"""
|
|
|
|
# GIVEN: test setup
|
|
|
|
projector1 = Projector(**TEST1_DATA)
|
|
|
|
self.projector.add_projector(projector1)
|
|
|
|
item = self.projector.get_projector_by_id(projector1.id)
|
|
|
|
item_id = item.id
|
|
|
|
|
|
|
|
# WHEN: A source entry is saved for item
|
|
|
|
source = ProjectorSource(projector_id=item_id, code='11', text='First RGB source')
|
|
|
|
self.projector.add_source(source)
|
|
|
|
|
|
|
|
# THEN: __repr__ should return a proper string
|
|
|
|
self.assertEqual(str(source),
|
|
|
|
'<ProjectorSource(id="1", code="11", text="First RGB source", projector_id="1")>',
|
|
|
|
'ProjectorSource.__repr__)_ should have returned a proper representation string')
|
2016-06-04 05:38:51 +00:00
|
|
|
|
|
|
|
def test_get_projector_by_id_none(self):
|
|
|
|
"""
|
2017-01-27 13:19:33 +00:00
|
|
|
Test get_projector_by_id() returns None if no db entry
|
2016-06-04 05:38:51 +00:00
|
|
|
"""
|
|
|
|
# GIVEN: Test object and data
|
|
|
|
projector = self.projector
|
|
|
|
|
|
|
|
# WHEN: DB search for entry not saved
|
|
|
|
results = projector.get_projector_by_id(dbid=123134556409824506)
|
|
|
|
|
|
|
|
# THEN: Verify return was None
|
|
|
|
self.assertEqual(results, None, 'Returned results should have equaled None')
|
2017-01-27 13:19:33 +00:00
|
|
|
|
2017-01-27 14:44:11 +00:00
|
|
|
def test_get_projector_all_none(self):
|
2017-01-27 13:19:33 +00:00
|
|
|
"""
|
|
|
|
Test get_projector_all() with no projectors in db
|
|
|
|
"""
|
|
|
|
# GIVEN: Test object with no data
|
2017-01-27 14:44:11 +00:00
|
|
|
projector = self.projector
|
2017-01-27 13:19:33 +00:00
|
|
|
|
|
|
|
# WHEN: We retrieve the database entries
|
2017-01-27 14:44:11 +00:00
|
|
|
results = projector.get_projector_all()
|
2017-01-27 13:19:33 +00:00
|
|
|
|
|
|
|
# THEN: Verify results is None
|
|
|
|
self.assertEqual(results, [], 'Returned results should have returned an empty list')
|
|
|
|
|
|
|
|
def test_get_projector_all_one(self):
|
|
|
|
"""
|
|
|
|
Test get_projector_all() with one entry in db
|
|
|
|
"""
|
|
|
|
# GIVEN: One entry in database
|
|
|
|
projector = Projector(**TEST1_DATA)
|
|
|
|
self.projector.add_projector(projector)
|
|
|
|
|
|
|
|
# WHEN: We retrieve the database entries
|
|
|
|
results = self.projector.get_projector_all()
|
|
|
|
|
|
|
|
# THEN: We should have a list with one entry
|
|
|
|
self.assertEqual(len(results), 1, 'Returned results should have returned a list with one entry')
|
|
|
|
self.assertTrue((projector in results), 'Result should have been equal to TEST1_DATA')
|
|
|
|
|
|
|
|
def test_get_projector_all_many(self):
|
|
|
|
"""
|
|
|
|
Test get_projector_all() with multiple entries in db
|
|
|
|
"""
|
|
|
|
# GIVEN: multiple entries in database
|
|
|
|
projector_list = []
|
|
|
|
projector_list.append(Projector(**TEST1_DATA))
|
|
|
|
projector_list.append(Projector(**TEST2_DATA))
|
|
|
|
projector_list.append(Projector(**TEST3_DATA))
|
|
|
|
for projector in projector_list:
|
|
|
|
self.projector.add_projector(projector)
|
|
|
|
|
|
|
|
# WHEN: We retrieve the database entries
|
|
|
|
results = self.projector.get_projector_all()
|
|
|
|
|
|
|
|
# THEN: We should have a list with three entries
|
2017-01-27 13:26:36 +00:00
|
|
|
self.assertEqual(len(results), len(projector_list),
|
|
|
|
'Returned results should have returned a list with three entries')
|
2017-01-27 13:19:33 +00:00
|
|
|
for projector in results:
|
2017-01-27 13:26:36 +00:00
|
|
|
self.assertTrue((projector in projector_list),
|
|
|
|
'Projector DB entry should have been in expected list')
|
2017-01-27 13:19:33 +00:00
|
|
|
|
|
|
|
def test_get_projector_by_name_fail(self):
|
|
|
|
"""
|
|
|
|
Test get_projector_by_name() fail
|
|
|
|
"""
|
|
|
|
# GIVEN: Test entry in database
|
|
|
|
self.projector.add_projector(Projector(**TEST1_DATA))
|
|
|
|
|
|
|
|
# WHEN: We attempt to get a projector that's not in database
|
|
|
|
results = self.projector.get_projector_by_name(name=TEST2_DATA['name'])
|
|
|
|
|
|
|
|
# THEN: We should have None
|
|
|
|
self.assertEqual(results, None, 'projector.get_projector_by_name() should have returned None')
|
|
|
|
|
|
|
|
def test_add_projector_fail(self):
|
|
|
|
"""
|
|
|
|
Test add_projector() fail
|
|
|
|
"""
|
|
|
|
# GIVEN: Test entry in the database
|
|
|
|
ignore_result = self.projector.add_projector(Projector(**TEST1_DATA))
|
|
|
|
|
|
|
|
# WHEN: Attempt to add same projector entry
|
|
|
|
results = self.projector.add_projector(Projector(**TEST1_DATA))
|
|
|
|
|
|
|
|
# THEN: We should have failed to add new entry
|
|
|
|
self.assertFalse(results, 'add_projector() should have failed')
|
|
|
|
|
|
|
|
def test_update_projector_default_fail(self):
|
|
|
|
"""
|
|
|
|
Test update_projector() with no options fails
|
|
|
|
"""
|
|
|
|
# GIVEN: projector instance
|
|
|
|
projector = self.projector
|
|
|
|
|
|
|
|
# WHEN: attempt to update a projector entry with no options
|
|
|
|
results = projector.update_projector()
|
|
|
|
|
|
|
|
# THEN: We should have failed
|
|
|
|
self.assertFalse(results, 'update_projector(projector=None) should have returned False')
|
|
|
|
|
|
|
|
def test_update_projector_not_in_db_fail(self):
|
|
|
|
"""
|
|
|
|
Test update_projector() when entry not in database
|
|
|
|
"""
|
|
|
|
# GIVEN: Projector entry in database
|
|
|
|
ignore_result = self.projector.add_projector(Projector(**TEST1_DATA))
|
|
|
|
projector = Projector(**TEST2_DATA)
|
|
|
|
|
|
|
|
# WHEN: Attempt to update data with a different ID
|
|
|
|
results = self.projector.update_projector(projector)
|
|
|
|
|
|
|
|
# THEN: Results should be False
|
|
|
|
self.assertFalse(results, 'update_projector(projector=projector) should have returned False')
|
|
|
|
|
|
|
|
def test_delete_projector_fail(self):
|
|
|
|
"""
|
|
|
|
Test delete_projector(projector) fails to delete record
|
|
|
|
"""
|
|
|
|
# GIVEN: Test entry in db
|
|
|
|
self.projector.add_projector(Projector(**TEST1_DATA))
|
|
|
|
|
|
|
|
# wHEN: Attempting to delete an entry not in the databae
|
|
|
|
results = self.projector.delete_projector(Projector(**TEST2_DATA))
|
|
|
|
|
|
|
|
# THEN: Results should be False
|
|
|
|
self.assertFalse(results, 'delete_projector() should have returned False')
|