Skip to content

Commit

Permalink
update model tests to point to new API call
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthchirp committed Apr 16, 2019
1 parent 75cbfaf commit 0ca45bc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/model/test_datacollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

def test_datacollection_model_retrieves_database_records():
db, record = mock.Mock(), mock.Mock()
db.retrieve_data_collection_main.return_value = [record]
db.retrieve_data_collection.return_value = [record]

dc = ispyb.model.datacollection.DataCollection(1234, db)
assert not db.retrieve_data_collection_main.called
assert not db.retrieve_data_collection.called
assert '1234' in str(dc)
assert '1234' in repr(dc)
assert 'uncached' in repr(dc)

dc.load()
db.retrieve_data_collection_main.assert_called_once_with(1234)
db.retrieve_data_collection.assert_called_once_with(1234)
assert dc._data == record
assert '1234' in repr(dc)
assert 'cached' in repr(dc) and 'uncached' not in repr(dc)

# Test caching behaviour
dc.load()
db.retrieve_data_collection_main.assert_called_once()
db.retrieve_data_collection.assert_called_once()


def test_datacollection_model_accepts_preloading():
Expand All @@ -32,7 +32,7 @@ def test_datacollection_model_accepts_preloading():
assert dc._data == record

dc.load()
assert not db.retrieve_data_collection_main.called
assert not db.retrieve_data_collection.called


database_column_to_attribute_name = {
Expand Down

0 comments on commit 0ca45bc

Please sign in to comment.