Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit ea1e330

Browse files
committed
[client] fixing import
1 parent 0a42091 commit ea1e330

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

pycti/entities/opencti_stix_cyber_observable.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import magic
88

9-
from pycti.entities.stix_cyber_observable.opencti_stix_cyber_observable_deprecated import (
9+
from .stix_cyber_observable.opencti_stix_cyber_observable_deprecated import (
1010
StixCyberObservableDeprecatedMixin,
1111
)
12-
from pycti.entities.stix_cyber_observable.opencti_stix_cyber_observable_properties import (
12+
from .stix_cyber_observable.opencti_stix_cyber_observable_properties import (
1313
SCO_PROPERTIES,
1414
SCO_PROPERTIES_WITH_FILES,
1515
)
@@ -18,7 +18,6 @@
1818
class StixCyberObservable(StixCyberObservableDeprecatedMixin):
1919
def __init__(self, opencti, file):
2020

21-
2221
self.opencti = opencti
2322
self.file = file
2423
self.properties = SCO_PROPERTIES

pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# dommage c'est du python 3.13, sinon deprecation lib
22
# from warnings import deprecated
33

4-
class StixCyberObservableDeprecatedMixin:
54

5+
class StixCyberObservableDeprecatedMixin:
66
"""
7-
deprecated >=6.2 & <6.5. Use `promote_to_indicator_v2`
8-
Promote a Stix-Observable to an Indicator
7+
deprecated >=6.2 & <6.5. Use `promote_to_indicator_v2`
8+
Promote a Stix-Observable to an Indicator
99
10-
:param id: the Stix-Observable id
11-
:return the observable
10+
:param id: the Stix-Observable id
11+
:return the observable
1212
"""
1313

1414
def promote_to_indicator(self, **kwargs):
@@ -25,17 +25,17 @@ def promote_to_indicator(self, **kwargs):
2525
},
2626
)
2727
query = (
28-
"""
28+
"""
2929
mutation StixCyberObservableEdit($id: ID!) {
3030
stixCyberObservableEdit(id: $id) {
3131
promote {
3232
"""
33-
+ (
34-
custom_attributes
35-
if custom_attributes is not None
36-
else (self.properties_with_files if with_files else self.properties)
37-
)
38-
+ """
33+
+ (
34+
custom_attributes
35+
if custom_attributes is not None
36+
else (self.properties_with_files if with_files else self.properties)
37+
)
38+
+ """
3939
}
4040
}
4141
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# coding: utf-8
2+
3+
4+
def test_promote_observable_to_indicator_deprecated(api_client):
5+
# DEPRECATED >=6.2 & <6.5. Use `promote_to_indicator_v2` instead
6+
obs1 = api_client.stix_cyber_observable.create(
7+
simple_observable_key="IPv4-Addr.value", simple_observable_value="55.55.55.55"
8+
)
9+
observable = api_client.stix_cyber_observable.promote_to_indicator(
10+
id=obs1.get("id")
11+
)
12+
assert observable is not None, "Returned observable is NoneType"
13+
assert observable.get("id") == obs1.get("id")

0 commit comments

Comments
 (0)