Files
deb-python-dcos/cli/tests/common.py
Charles Ruhland ec496dcd14 Add Marathon pods support (#778)
- Commands detect if Marathon provides the pods API
- Commands supported: add, list, remove, show, update
- Rename `dcos.util.normalize_app_id()` to `normalize_marathod_id_path()`.
- Make Marathon 409 response status error message less confusing
- Marathon deployment table view now includes pods
2016-09-30 14:50:56 -07:00

34 lines
790 B
Python

import six
def assert_same_elements(list1, list2):
"""Tests whether the second argument is a rearrangement of the first.
This method will work even if the list elements are mutable and/or cannot
be sorted. A common use case is comparing lists of JSON objects, since
the objects are usually implemented with dicts.
:param list1: the first list
:type: list
:param list2: the second list
:type: list
:rtype: None
"""
list2 = list2.copy()
for element in list1:
list2.remove(element)
assert list2 == []
def file_bytes(path):
""" Read all bytes from a file
:param path: path to file
:type path: str
:rtype: bytes
:returns: bytes from the file
"""
with open(path) as f:
return six.b(f.read())