Ghostkeeper
6ba79881df
Use new container registry functionality for test_setDefinitionByIdExists
...
We can just set the return value of the registry to whatever we like and we'll verify that we got that from the registry and it was put on the stack.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Ghostkeeper
4f83ae3fa7
Remove unused import
...
It was removed when we removed some of the mocking code earlier.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Ghostkeeper
c3ad7d114a
Set return value of registry.findContainers in the test
...
This way we need to mock way less. It's the min-cut.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Ghostkeeper
8dc073f5c8
Add container types to fallthrough tests
...
This checks exactly the same code as the global stack.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Ghostkeeper
b97ef58436
Remove redundant deserialize tests
...
They test Uranium code, not this module.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Ghostkeeper
4bb217592f
Refactor deserialise tests
...
These are now essentially testing the same code as the similar tests for the global stack. This is ugly but without looking at the implementation this is correct.
Contributes to issue CURA-3497.
2017-04-12 10:00:43 +02:00
Arjen Hiemstra
93e42164a8
Make value unit tests also provide a "state" property
...
Since we now use state to determine whether we should perform resolve or
not.
2017-04-11 13:56:40 +02:00
Ghostkeeper
70dc9fd95b
Document why we skip this test for now
...
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Ghostkeeper
1c2ce5b8b1
Remove old getPropertyWithResolve test
...
It has been replaced by several separate tests right above it.
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Ghostkeeper
86b288cc6e
Add test for when instances have value and definition has resolve
...
The value of the instances should always get evaluated first.
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Ghostkeeper
759da2ab05
Add test for value winning over resolve in instances
...
In instance containers, if there's both a resolve and a value, it should take the value.
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Ghostkeeper
0a7bcc4277
Add test for when there's no resolve in definitions
...
It must not attempt to execute a resolve function then.
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Ghostkeeper
12d1db8f19
Add test for whether resolve wins in definition
...
I'm splitting the test below up into pieces. It'll be removed eventually, when I've made all of these separate tests.
Contributes to issue CURA-3497.
2017-04-11 10:42:17 +02:00
Arjen Hiemstra
73779eef25
Properly set the ContainerRegistry for the missing container test
2017-04-10 18:06:24 +02:00
Ghostkeeper
dfd8cfb2b8
Skip test_deserializeMoveDefinitionContainer
...
This test is currently failing because of a weird hack we're doing to get around a Uranium bug: We're searching only through definitions that have a category, any category. This is done because Uranium requires a search to have some metadata entry to search on. We'll have to refactor that eventually but for now that is out of scope.
Contributes to issue CURA-3497.
2017-04-10 17:17:13 +02:00
Ghostkeeper
71aca6aa4b
Remove old deserialize tests
...
Most of these tests also tested the Uranium code, which it should mock out. The last test, test_deserializeMissingContainer, is caught by the currently existing tests.
Contributes to issue CURA-3497.
2017-04-10 17:14:50 +02:00
Ghostkeeper
f12ffad2c1
Add test for moving definition containers
...
When a definition container is in the wrong spot in a stack file it needs to be moved to the definition slot.
Contributes to issue CURA-3497.
2017-04-10 17:12:27 +02:00
Ghostkeeper
e807739117
Add test for moving containers through deserialising
...
When a container in the stack file is located in the wrong spot, it needs to move the container to the correct spot.
Contributes to issue CURA-3497.
2017-04-10 17:08:23 +02:00
Ghostkeeper
f27e7fca88
Document test_deserializeWrongDefinitionClass
...
Contributes to issue CURA-3497.
2017-04-10 16:46:47 +02:00
Ghostkeeper
5e9695773a
Add test for instance containers on definition spot
...
When deserialize finds an instance container in the definition spot and no other container to replace it with, it should raise an exception because stacks must have a definition.
Contributes to issue CURA-3497.
2017-04-10 16:45:42 +02:00
Ghostkeeper
00412e905f
Add test for removing definitions from instance locations
...
When deserialize finds a definition in an instance container spot it should replace it with an empty container.
Contributes to issue CURA-3497.
2017-04-10 16:43:51 +02:00
Ghostkeeper
a955c3dfdd
Add test for removing invalid instance containers from serialisation
...
If deserialize finds a container that has the wrong type it should replace it with an empty container.
Contributes to issue CURA-3497.
2017-04-10 16:41:05 +02:00
Ghostkeeper
64ce8c0bb1
Add test for whether an empty stack deserialises to proper size
...
It must be padded with empty containers. The test currently fails, and we concluded that we won't fix it as part of this refactor. We'll refactor this later and put it on skip until then to indicate a todo.
Contributes to issue CURA-3497.
2017-04-10 16:39:46 +02:00
Ghostkeeper
069235f9e0
Split test_constrainContainerTypes into multiple tests
...
This way the first assertion won't cause all of these tests to break if multiple are failing. It also removes the need for any state to be saved between these tests which is bad practice, and it adds a few tests for the unhappy path.
Contributes to issue CURA-3497.
2017-04-10 13:23:11 +02:00
Ghostkeeper
2cdb6c5f6f
Split test_constrainContainerTypes into separate tests
...
Firstly, it'll no longer break on the first assert if multiple things are wrong. Secondly, it can now set different types for each container and put it in the correct slot then.
Contributes to issue CURA-3497.
2017-04-10 12:54:35 +02:00
Ghostkeeper
d74aa4d24e
Don't get with default from dictionary using named parameters
...
That doesn't work for some reason.
Contributes to issue CURA-3497.
2017-04-07 17:02:00 +02:00
Ghostkeeper
16b3c78667
Guard against type checking of DefinitionContainer
...
Otherwise it finds that we're trying to set a MagicMock into the definition slot.
Contributes to issue CURA-3497.
2017-04-07 16:58:47 +02:00
Ghostkeeper
7158ebdaea
Guard against type checking when replacing definition container
...
Otherwise it finds that this is not a definition container we're replacing the definition with.
Contributes to issue CURA-3497.
2017-04-07 16:54:21 +02:00
Ghostkeeper
d5df226024
Cache the indexes class
...
This improves readability a bit.
Contributes to issue CURA-3497.
2017-04-07 16:45:10 +02:00
Ghostkeeper
f4fcb50a4f
Fix container types of mock containers in fallthrough
...
It needs to create a container of each type or else setting the container will raise alarm.
Contributes to issue CURA-3497.
2017-04-07 16:41:02 +02:00
Ghostkeeper
4dfc86d5bb
Remove unused import
...
Contributes to issue CURA-3497.
2017-04-07 14:59:04 +02:00
Ghostkeeper
e71af663c3
Make getEmptyInstanceContainer return a container with ID 'empty'
...
This is checked in the test. Otherwise it would return magic mocks.
Contributes to issue CURA-3497.
2017-04-07 14:41:29 +02:00
Ghostkeeper
7ce89f5d80
Simplify defaults for container IDs in fixtures
...
Contributes to issue CURA-3497.
2017-04-07 14:02:39 +02:00
Ghostkeeper
46f3b5bd97
Use yield_fixture for fixtures with teardown
...
Otherwise it'll complain that it can't use yield.
Contributes to issue CURA-3497.
2017-04-07 13:13:12 +02:00
Ghostkeeper
8506c21099
Replace DefinitionContainer with MagicMock in test_addExtruder
...
Because the code checks for the type of DefinitionContainer.
Contributes to issue CURA-3497.
2017-04-06 16:30:04 +02:00
Jack Ha
1ebf947ff2
Added tests for ShapeArray. CURA-3239
2017-04-03 17:03:30 +02:00
Jack Ha
d1b9078657
Added first arranger tests, small refactors. CURA-3239
2017-04-03 16:36:48 +02:00
Arjen Hiemstra
e6adca7dd3
Fix type metadata of some of the test container stacks
2017-03-30 08:58:46 +02:00
Arjen Hiemstra
d7984c888b
Use a proper container mock for test user/quality changes
2017-03-28 18:20:13 +02:00
Arjen Hiemstra
30fd1ded45
Fix setPropertyOtherContainers test
...
Now uses writable stack and makes sure to compare the right values
2017-03-28 18:19:30 +02:00
Arjen Hiemstra
3c1cbd5aa9
Do not compare string to actual type
...
As far as we know, Global or Container stack should not take care of
string -> value conversion
2017-03-28 18:18:29 +02:00
Arjen Hiemstra
3620ce4c0a
Fix setPropertyUser test with the right container and parameter order of setProperty
2017-03-28 18:17:12 +02:00
Arjen Hiemstra
87ce6246d8
Introduce a "writable global stack" fixture
...
This one has MockContainers set for all containers that allow calling
setProperty
2017-03-28 18:16:00 +02:00
Arjen Hiemstra
dc84141714
Implement set/getProperty for MockContainer
...
Otherwise setProperty/getProperty tests will never work
2017-03-28 17:51:46 +02:00
Arjen Hiemstra
7175ac0d20
Do not try to perform a setProperty on a definition
...
That is never going to work
2017-03-28 17:50:37 +02:00
Arjen Hiemstra
2a2df31c5b
Set the User container to a writable container in testSetProperty
...
Since empty container (the default) will not allow writes
2017-03-28 17:50:09 +02:00
Arjen Hiemstra
3f1f4a172d
Fix constrainContainerTypes test
...
We do not allow random containers to be assigned to specific properties,
only the containers that specify they are of a certain type.
2017-03-28 17:48:55 +02:00
Arjen Hiemstra
593c6c0c8f
Set and clear ContainerStack's _containerRegistry property
2017-03-28 17:47:10 +02:00
Arjen Hiemstra
8f36e76588
Make sure to use the right metadata type entry for mock containers
2017-03-27 17:57:07 +02:00
Arjen Hiemstra
60ee1a3f75
We also raise InvalidContainer when setting variant
2017-03-27 17:56:46 +02:00